<script setup lang="ts">
import { ref } from 'vue'
import radioCell from '@/components/radio-cell.vue'

const emit = defineEmits(['close'])
const show = ref(false)
defineExpose({
  show,
})

const editRef = ref()
const formModel = ref({
  name: '',
  price: '',
  coin: '',
})
const wxlist = [
  {
    label: '微信',
    value: '1',
  },
  {
    label: '支付宝',
    value: '2',
  },
]
const zfblist = [
  {
    label: '微信',
    value: '1',
  },
  {
    label: '支付宝',
    value: '2',
  },
]

function handleSubmit() {
  editRef.value.validate().then(({ valid, errors }) => {
    if (valid) {
      console.log('表单验证通过')
      // 提交表单逻辑
      emit('close', false)
      show.value = false
    }
    else {
      console.log('表单验证不通过')
    }
  })
}
function handleClose() {
//   show.value = false

}
const fileList = ref([])
function handleChange(file) {
  console.log('文件上传变化:', file)
  fileList.value.push(file)
}
</script>

<template>
  <wd-popup v-model="show" lock-scroll position="bottom" :safe-area-inset-bottom="true" closable custom-style="height: 80%;overflow: hidden;border-radius: 32rpx 32rpx 0 0;" @close="handleClose">
    <view class="wot-form-title">
      【 设备＞软件配置 】
    </view>
    <scroll-view scroll-y>
      <view class="list">
        <view class="l-item">
          <view class="i-title">
            1.正面 (必填)
          </view>
          <wd-upload
            :file-list="fileList"
            :limit="1"
            action="https://mockapi.eolink.com/zhTuw2P8c29bc981a741931bdd86eb04dc1e8fd64865cb5/upload"
            @change="handleChange"
          />
        </view>
      </view>
    </scroll-view>
  </wd-popup>
</template>

<style lang="scss" scoped>
.desc{
    padding: 40rpx 20rpx;
    line-height: 40rpx;
    font-size: 24rpx;
    color: #ED6A0C;
}
</style>
